home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_perl.idb / usr / freeware / catman / p_man / cat3 / Net::protoent.Z / Net::protoent
Encoding:
Text File  |  1998-10-28  |  3.3 KB  |  133 lines

  1.  
  2.  
  3.  
  4.      NNNNeeeetttt::::::::pppprrrroooottttooooeeeennnntttt((((3333))))22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222)))) NNNNeeeetttt::::::::pppprrrroooottttooooeeeennnntttt((((3333))))
  5.  
  6.  
  7.  
  8.      NNNNAAAAMMMMEEEE
  9.       Net::protoent    - by-name interface to Perl's built-in
  10.       getproto*() functions
  11.  
  12.      SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  13.        use Net::protoent;
  14.        $p =    getprotobyname(shift ||    'tcp') || die "no proto";
  15.        printf "proto for %s    is %d, aliases are %s\n",
  16.           $p->name,    $p->proto, "@{$p->aliases}";
  17.  
  18.        use Net::protoent qw(:FIELDS);
  19.        getprotobyname(shift    || 'tcp') || die "no proto";
  20.        print "proto    for $p_name is $p_proto, aliases are @p_aliases\n";
  21.  
  22.  
  23.      DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  24.       This module's    default    exports    override the core
  25.       _g_e_t_p_r_o_t_o_e_n_t(), _g_e_t_p_r_o_t_o_b_y_n_a_m_e(), and _g_e_t_n_e_t_b_y_p_o_r_t()
  26.       functions, replacing them with versions that return
  27.       "Net::protoent" objects.  They take default second arguments
  28.       of "tcp".  This object has methods that return the similarly
  29.       named    structure field    name from the C's protoent structure
  30.       from _n_e_t_d_b._h;    namely name, aliases, and proto.  The aliases
  31.       method returns an array reference, the rest scalars.
  32.  
  33.       You may also import all the structure    fields directly    into
  34.       your namespace as regular variables using the    :FIELDS    import
  35.       tag.    (Note that this    still overrides    your core functions.)
  36.       Access these fields as variables named with a    preceding p_.
  37.       Thus,    $proto_obj->name() corresponds to $p_name if you
  38.       import the fields.  Array references are available as
  39.       regular array    variables, so for example @{ $proto_obj-
  40.       >aliases() } would be    simply @p_aliases.
  41.  
  42.       The _g_e_t_p_r_o_t_o() function is a simple front-end    that forwards
  43.       a numeric argument to    _g_e_t_p_r_o_t_o_b_y_p_o_r_t(), and the rest to
  44.       _g_e_t_p_r_o_t_o_b_y_n_a_m_e().
  45.  
  46.       To access this functionality without the core    overrides,
  47.       pass the use an empty    import list, and then access function
  48.       functions with their full qualified names.  On the other
  49.       hand,    the built-ins are still    available via the CORE::
  50.       pseudo-package.
  51.  
  52.      NNNNOOOOTTTTEEEE
  53.       While    this class is currently    implemented using the
  54.       Class::Struct    module to build    a struct-like class, you
  55.       shouldn't rely upon this.
  56.  
  57.      AAAAUUUUTTTTHHHHOOOORRRR
  58.       Tom Christiansen
  59.  
  60.  
  61.  
  62.  
  63.      Page 1                        (printed 10/23/98)
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.      NNNNeeeetttt::::::::pppprrrroooottttooooeeeennnntttt((((3333))))22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222)))) NNNNeeeetttt::::::::pppprrrroooottttooooeeeennnntttt((((3333))))
  71.  
  72.  
  73.  
  74.  
  75.  
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.      Page 2                        (printed 10/23/98)
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.